<template>
	<view class="my-content _page">
		<!-- 通知 -->
		<Notification />
		<!-- 通知 -->
		<div class="status-bar"></div>
		<view class="order_top" style="z-index: 999;">

			<!--这里是订单导航tabbar-->
			<view class="lxy-content">
				<scroll-view scroll-x="true" class="content-scroll" scroll-with-animation :scroll-left="scrollLeft">
					<block v-if="lang==='zh'">
						<view class="tabs scroll-item" :class="[current == index ? 'border' : '']"
							v-for="(item, index) in list" :key="index" @click="change(index)">
							{{item.name}}
						</view>
					</block>
					<block v-if="lang!='zh'">
						<view class="tabs_ru scroll-item" :class="[current == index ? 'border' : '']"
							v-for="(item, index) in list" :key="index" @click="change(index)">
							{{item.name}}
						</view>
					</block>
				</scroll-view>
			</view>

			<!--这里是订单导航筛选器-->
			<u-dropdown active-color="#FF8006" style="background: #F6F6F6;">
				<u-dropdown-item v-model="value0" :options="options0" active-color="#FF8006" :title="$t('状态')"
					@change="select"></u-dropdown-item>
				<u-dropdown-item v-model="value1" :options="options1" active-color="#FF8006" :title="$t('行业')"
					@change="select"></u-dropdown-item>
				<u-dropdown-item v-model="value2" :options="options2" :title="$t('发布时间')"
					@change="select"></u-dropdown-item>
			</u-dropdown>
		</view>



	</view>
</template>

<script>
	import {
		HTTP_IMG_UTL
	} from '@/config/app';
	

	export default {
		components: {
			
		},
		computed: {
			
		},
		watch: {
			
		},
		data() {
			return {
				show: false,
				lang: this.$i18n.locale,

				isShow: 0,
				contentScrollW: 0, // 导航区宽度
				current: 1, // 当前选中
				scrollLeft: 0, // 横向滚动条位置

				/* 状态配置 
				"已发布":"Опубликовано",
				"已参与": "Участвовал",
				"进行中": "В настоящее время",
				"已完成": "Готово'или'Выполнено",	
				*/
				nav_class: "tabs",
				list: [{
						name: this.$t('全部'),
						zn: HTTP_IMG_UTL + 'Zyifabu.jpg',
						ru: HTTP_IMG_UTL + 'yifabu.jpg'
					},
					{
						name: this.$t('已发布'),
						zn: HTTP_IMG_UTL + 'Zyifabu.jpg',
						ru: HTTP_IMG_UTL + 'yifabu.jpg'
					}, {
						name: this.$t('已参与'),
						zn: HTTP_IMG_UTL + 'Zyicanyu.jpg',
						ru: HTTP_IMG_UTL + 'yicanyu.jpg'
					}, {
						name: this.$t('进行中'),
						zn: HTTP_IMG_UTL + 'Zjinxinzhong.jpg',
						ru: HTTP_IMG_UTL + 'jinxingzhong.jpg'
					}, {
						name: this.$t('已完成'),
						zn: HTTP_IMG_UTL + 'Zyiwancheng.jpg',
						ru: HTTP_IMG_UTL + 'yiwancheng.jpg'
					},
					{
						name: this.$t('申请售后'),
						zn: HTTP_IMG_UTL + 'Zyiwancheng.jpg',
						ru: HTTP_IMG_UTL + 'yiwancheng.jpg'
					},
				],
				value0: 0,
				value1: 1,
				value2: 2,
				options0: [{
						label: this.$t('全部'),
						label_ru: this.$t('全部'),
						value: 0,
					},
					{
						label: this.$t('正常'),
						label_ru: this.$t('正常'),
						value: 1,
					},
					{
						label: this.$t('异常'),
						label_ru: this.$t('异常'),
						value: 2,
					},
				],


				options1: [{
						label: this.$t('不限'),
						label_ru: this.$t('不限'),
						value: '',
					},
					{
						label: this.$t('货物') + this.$t('竞标'),
						label_ru: this.$t('货物') + this.$t('竞标'),
						value: 'goods',
					},
					{
						label: this.$t('运输') + this.$t('竞标'),
						label_ru: this.$t('运输') + this.$t('竞标'),
						value: 'transport',
					},
					{
						label: this.$t('跨境货代') + this.$t('竞标'),
						label_ru: this.$t('跨境货代') + this.$t('竞标'),
						value: 'crossborder',
					},
					{
						label: this.$t('专业代办') + this.$t('竞标'),
						label_ru: this.$t('专业代办') + this.$t('竞标'),
						value: 'professional',
					}
				],
				options2: [{
						label: this.$t('不限'),
						label_ru: this.$t('不限'),
						value: '',
					},
					{
						label: this.$t('近三天'),
						label_ru: this.$t('近三天'),
						value: 3,
					},
					{
						label: this.$t('近五天'),
						label_ru: this.$t('近五天'),
						value: 5,
					},
					{
						label: this.$t('近七天'),
						label_ru: this.$t('近七天'),
						value: 7,
					},
				],
				orderList: [],
				search: '',
				pop: {},
				triggered: false, //刷新设置

				listLang: [],
				page: 1, //分页
				identity_type: ""
			}
		},
		onLoad() {

		},
		onShow() {
			this.getList()
			this.setTabbarName()

			this.$store.commit("getC2cUnreadMsgNum")
			let identity_type = uni.getStorageSync('userInfoFull');
			this.identity_type = identity_type.identity_type
		},
		onReady() {
			this.getScrollW()
			uni.setNavigationBarTitle({
				title: this.$t("订单")
			})
		},
		methods: {
			setTabbarName() {
				if (uni.getStorageSync("lang") != 'ru') {
					uni.setTabBarItem({
						index: 0, // tabIndex，tabbar的哪一项，从0开始
						text: '首页', // 新的名称
					});
					uni.setTabBarItem({
						index: 1, // tabIndex，tabbar的哪一项，从0开始
						text: '工作台', // 新的名称
					});
					uni.setTabBarItem({
						index: 2, // tabIndex，tabbar的哪一项，从0开始
						text: '发布', // 新的名称
					});
					uni.setTabBarItem({
						index: 3, // tabIndex，tabbar的哪一项，从0开始
						text: '消息', // 新的名称
					});
					uni.setTabBarItem({
						index: 4, // tabIndex，tabbar的哪一项，从0开始
						text: '我的', // 新的名称
					});
				} else {
					uni.setTabBarItem({
						index: 0, // tabIndex，tabbar的哪一项，从0开始
						text: 'Главная', // 新的名称
					});
					uni.setTabBarItem({
						index: 1, // tabIndex，tabbar的哪一项，从0开始
						text: 'Кабинет', // 新的名称
					});
					uni.setTabBarItem({
						index: 2, // tabIndex，tabbar的哪一项，从0开始
						text: 'Опубликовать', // 新的名称
					});
					uni.setTabBarItem({
						index: 3, // tabIndex，tabbar的哪一项，从0开始
						text: 'Сообщения', // 新的名称
					});
					uni.setTabBarItem({
						index: 4, // tabIndex，tabbar的哪一项，从0开始
						text: 'Мой', // 新的名称
					});
				}
			},
			getC2cUnreadMsgNum() {
				const that = this
				var mobile = uni.getStorageSync('mobile');

				that.isShow = 1
				that.$u.api.message.getC2cUnreadMsgNum({
					mobile: mobile,
				}).then(res => {
					that.$u.api.basic.getNoticeNum().then(r => {
						that.listLang = [{
								iconPath: "/static/images/tabbar/newStyle/t1.png",
								selectedIconPath: "/static/images/tabbar/t1s.png",
								text: that.$t('首页'),
								// count: 2,
								// isDot: true,
								customIcon: false,
								pagePath: '/pages/tabbar/index'
							},
							{
								iconPath: "/static/images/tabbar/newStyle/t2.png",
								selectedIconPath: "/static/images/tabbar/t2s.png",
								text: that.$t('订单'),
								customIcon: false,
								// isDot: true,
								pagePath: '/pages/tabbar/order/index'
							},
							{
								iconPath: "/static/images/tabbar/newStyle/t3.png",
								selectedIconPath: "/static/images/tabbar/t3s.png",
								text: that.$t('发布'),
								midButton: true,
								customIcon: false,
								pagePath: '/pages/tabbar/release/index'
							},
							{
								iconPath: "/static/images/tabbar/newStyle/t4.png",
								selectedIconPath: "/static/images/tabbar/t4s.png",
								text: that.$t('消息'),
								count: Number(res.AllC2CUnreadMsgNum) + Number(r.other) + Number(r
									.system),
								customIcon: false,
								pagePath: '/TUIKit/components/TUIConversation/list'
							},
							{
								iconPath: "/static/images/tabbar/newStyle/t5.png",
								selectedIconPath: "/static/images/tabbar/t5s.png",
								text: that.$t('我的'),
								// count: 23,
								// isDot: false,
								customIcon: false,
								pagePath: '/pages/tabbar/user/index'
							},
						]
						that.isShow = 0

					})
				})
			},

			// 滑轮滚动到顶
			scrolltolowers(e) {
				if (this.orderList.length === 0) {
					return
				}
				this.page++
				this.getList()
			},

			getList() {
				const that = this
			},


			change(index) {
				this.current = index;
				this.page = 1
				this.orderList = []
				this.getList()
			},

			select(value) {
				this.search = value
				this.getList()
			},

			// 获取标题区域宽度，和每个子元素节点的宽度以及元素距离左边栏的距离
			getScrollW() {
				const query = uni.createSelectorQuery().in(this);
				query.select('.content-scroll').boundingClientRect(data => {
					// 拿到 scroll-view 组件宽度
					this.contentScrollW = data.width
				}).exec();
				query.selectAll('.scroll-item').boundingClientRect(data => {
					let dataLen = data.length;
					for (let i = 0; i < dataLen; i++) {
						//  scroll-view 子元素组件距离左边栏的距离
						this.list[i].left = data[i].left;
						//  scroll-view 子元素组件宽度
						this.list[i].width = data[i].width
					}
				}).exec()
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .u-dropdown__menu {
		margin-bottom: 0 !important;
		margin-top: 0 !important;
	}

	page {
		background-color: #fff;
	}

	.my-text {
		font-size: 12px;
	}

	/*横向滚动操作*/
	.lxy-content {
		width: 100%;
		height: 100rpx;
		box-sizing: border-box;

		.content-scroll {
			height: 100rpx;
			white-space: nowrap;

			.scroll-item {
				display: inline-block;
				text-align: center;
				margin-right: 28rpx;
				padding-right: 0 24rpx;

				&.active {
					color: #FFFFFF;
				}
			}

			.scroll-item:last-child {
				margin-right: 28rpx;
			}
		}
	}

	@keyframes changeImg {
		from {
			left: -100%;
		}

		100% {
			left: 150%;
		}
	}

	.my-order-item {
		display: flex;
		margin-bottom: 20rpx;
		padding-left: 0rpx;
		margin-top: -20px;
	}

	.tabs {
		width: 23%;
		height: 60rpx;
		border-radius: 10rpx;
		text-align: center;
		line-height: 60rpx;
		overflow: hidden;
		background-color: #f6f6f6;
		color: #999999;
		margin: 10px;
		font-size: 24rpx;
	}

	.tabs_ru {
		border-radius: 10rpx;
		text-align: center;
		line-height: 26rpx;
		word-break: break-word;
		font-size: 12px;
		background-color: #f6f6f6;
		color: #999999;
		padding: 12rpx;
		margin: 2px;
	}

	.order_top {
		//padding-top: 97.67rpx;
		// position: fixed;
		// top: 0;
		// left: 0;
		width: 100%;
		background: #FFFFFF;
		box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(233, 233, 233, 0.5);
		border-radius: 0rpx 0rpx 12rpx 12rpx;
	}

	._page {
		// margin-top: 250.93rpx;
		display: flex;
		flex-direction: column;
	}

	.order_body {
		flex: 1;
		padding: 24.2rpx;
		overflow: scroll;

		.order_card {
			margin-top: 20.93rpx;
			// min-height: 427rpx;
			// background: #FFFFFF;
			// box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(207, 207, 207, 0.5);
			// border-radius: 14rpx;
			// overflow: hidden;
		}
	}

	.order_body_top {
		display: flex;
		flex-direction: column;

		// height: 291.28rpx;
		.order_btn {
			display: flex;
			justify-content: space-between;

			.order_btn_view {
				// background: url("/static/images/order/jvxing.png");
				background: linear-gradient(132deg, #FBAA52 0%, #E96444 100%);
				// width: 200rpx;
				height: 43.6rpx;
				// display: flex;
				// justify-content: center;
				// align-items: center;
				color: $my-bgColorFFFFFF;
				// overflow: hidden;
				// white-space: nowrap;
				// text-overflow: ellipsis;
				padding: 10rpx;
				line-height: 23rpx;
				text-align: center;
				position: relative;

				&::after {
					position: absolute;
					animation: changeImg 3s ease 0s;
					top: 0;
					width: 30%;
					height: 100%;
					content: "";
					background: linear-gradient(to right, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .4) 50%, rgba(255, 255, 255, 0) 100%);
					transform: skewX(-45deg);
					animation-iteration-count: infinite;
				}
			}
		}
	}

	.order_list {
		margin-top: 34.88rpx;
		padding-left: 26.16rpx;
		// font-size: 29rpx;
		font-weight: 400;
		color: #0B0B0B;
		line-height: 40rpx;

		view {
			margin-bottom: 15rpx;
		}

		text {
			&:first-child {
				color: #aaa;
			}

			&:last-child {
				color: #333;
				font-size: 32rpx;
			}
		}
	}

	.order_address {
		padding-top: 26.16rpx;
		padding-bottom: 12rpx;
		padding-left: 26.16rpx;
		border-bottom: 2rpx solid #E5E5E5;

		view {
			display: flex;
			flex-direction: row;
			font-size: 29rpx;
			font-weight: 400;
			color: #888888;
			line-height: 30rpx;
			padding-bottom: 10rpx;
		}

		text {
			font-size: 29rpx;
			font-weight: 400;
			color: #888888;
			line-height: 30rpx;
		}
	}

	.order_body_details {
		display: flex;
		flex-direction: row;
		justify-content: stretch;
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;

		&>view {
			width: 100%;
		}

		// margin-top: 63rpx;
	}

	.itemBox {
		padding-bottom: 70rpx;
	}

	.order_body_details1 {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		padding: 19.19rpx;
	}

	.border {
		//border: 6rpx solid rgb(27, 27, 111);
		background: linear-gradient(180deg, #E7FDB3 -2%, #FFFFFF 85%);
		color: #3d3d3d;
		font-weight: bold;
	}

	.my-edit {
		// background: linear-gradient(132deg, #FBAA52 0%, #E96444 100%);
		// color: #FFFFFF;
		// padding: 4rpx;
		// max-width: 200rpx;
		// font-size: 12px;
		max-width: 240rpx;
		height: 100%;
		background: linear-gradient(132deg, #FBAA52 0%, #E96444 100%);
		border-radius: 14rpx;
		font-size: 29rpx;
		font-weight: 600;
		color: #FFFFFF;
		line-height: 29rpx;
		padding: 15rpx;
		box-sizing: border-box;
		margin-right: 30rpx;
		text-align: center;
	}

	.estimate {
		display: flex;
		justify-content: space-around;

		view {
			width: 140rpx;
			height: 80rpx;
			// text-align: center;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 80rpx;
		}
	}

	.order_body_details {}

	.three {
		.button:nth-of-type(1) {
			border-bottom-right-radius: 0;
			background: #f6f6f6 !important;
		}

		.button:nth-of-type(2) {
			border-bottom-left-radius: 0;
			border-bottom-right-radius: 0;
			background: linear-gradient(to right, #D7F09D 0%, #F8FCF1 81%);
		}

		.button:nth-of-type(3) {
			border-bottom-left-radius: 0;
		}
	}

	.button {
		width: 100%;
		background: linear-gradient(99deg, #FF8C7B 15%, #FFD1A2 99%);
		color: #3d3d3d;
		font-size: 24rpx;
		line-height: 35rpx;
		text-align: center;
		padding: 15rpx;
		bottom: 0;
		left: 0;
		border-radius: 0 0 14rpx 14rpx;
	}

	.circle_ {
		width: 35rpx;
		height: 35rpx;
		border: 1px solid #ccc;
		background-color: #ffffff;
		border-radius: 50rpx;
		float: left;
		margin-top: 10rpx;
	}

	.after_sale_text {
		width: 60%;
		font-size: 10px;
		text-align: left;
		margin: 0rpx 3%;
		padding: 20rpx 0rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		position: relative;
	}

	.after_sale_time {
		width: 40%;
		font-size: 10px;
		text-align: right;
		margin: 0rpx 10rpx;
		padding: 20rpx 0rpx;
	}

	.scroll-view {
		white-space: nowrap;
	}

	.scroll-text {
		display: inline-block;
		width: 100%;
		animation: scroll-animation 3s linear infinite;
	}

	@keyframes scroll-animation {
		0% {
			transform: translateY(0);
		}

		100% {
			transform: translateY(-150%);
		}
	}

	.status-bar {
		margin-top: var(--status-bar-height);
		height: 24rpx;
	}

	.type-status {
		padding: 5rpx 16rpx;
		background-color: #06C36E;
		color: white;
		border-radius: 10rpx;
	}

	// 2024/11/15 新增
	.order_body_details.purchase_wrap {
		.button {
			color: #fff;
			height: 70rpx;
			border-radius: 0px 0px 32rpx 32rpx;
			background: linear-gradient(270deg, #CCE7F9 0%, #5282E6 100%);
		}
	}

	.right_title {
		color: #3d3d3d;
		font-size: 12px;
		float: right;
	}

	.pur_color {
		.right_title {
			color: #47A8FF;
		}

	}

	.my_wrap {
		padding: 2px 4px;
		background-color: #06C36E;
		color: white;
		border-radius: 10rpx;
	}

	.pur_style {
		&.my_wrap {
			border-radius: 10rpx;
			padding: 10rpx 16rpx;
			display: inline-flex;
		}
	}
</style>